package com.juyu.miliao.common.util;

import com.juyu.miliao.common.constant.AppPackageIdConstant;

import javax.servlet.http.HttpServletRequest;

/**
 * @author jh
 * 2018/11/6
 */
public class AppPackageIdUtil {

    /**
     * 获取appPackageId
     *
     * @param appPackageId appPackageId
     * @return String
     */
    public static String null2AppPackageId(String appPackageId) {
        if (CommonUtil.isEmptyString(appPackageId)) {
            return AppPackageIdConstant.DEFAULT_APP_PACKAGE_ID;
        }
        return appPackageId.trim();
    }

    /**
     * appPackageId
     *
     * @param request request
     * @return String
     */
    public static String null2AppPackageId(HttpServletRequest request) {
        String appPackageId = request.getHeader("appPackageId");
        if (CommonUtil.isEmptyString(appPackageId)) {
            return AppPackageIdConstant.DEFAULT_APP_PACKAGE_ID;
        }
        return appPackageId.trim();
    }

}
